﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Pixysoft.Framework.Security
{
    class StringHelper
    {
        public const string global_framework_id = "pixysoft.framework.security";

        public const string global_configuartion_configname = "SecurityConfiguration";

        public const int default_cache_timespan = 60;

        public const string default_log_webstie = "pixysoft.website.log";


        //匿名登录的名
        public const string anonymousName = "guest";
        //服务器内部跳动名
        public const string transferName = ".transfer";
        //传递信息名
        public const string messageName = ".message";


        //登录时候的返回url加密钥匙
        public const string desKey = "helloworld";

        //自动登录的cookie
        public const string cookieName_autologin = ".helloworld.autologin";
        //保存用户信息的cookie名
        public const string cookieName_userinfo = ".helloworld.userinfo";

        //登录时返回url的查询名
        public const string querystring_redirectName = ".redirect";
        //站点的sso入口位置
        public const string querystring_ssoName = ".sso";
        //sso handler操作方法名
        public const string querystring_commandName = ".cmd";


        //不需要验证的网页后缀（htm等，正则表达式）
        public const string skipUrlExts = "html|htm|php|asp|css|jpg|jpeg|gif|bmp|axd|js|asmx|xml|png";
        //系统默认需要验证的页面
        public const string authUrlExts = "aspx";
        //不需要验证的资源后缀
        public const string skipObjExts = "txt";
        //可以忽略的请求参数
        public const string skipRequestExts = ".jmethod";


        public static string GetToken()
        {
            string token = Guid.NewGuid().ToString();

            return token;
        }
    }

    class SSoCommandCollection
    {
        /// <summary>
        /// token登录
        /// </summary>
        public const string TokenLogin = "TokenLogin";
        /// <summary>
        /// token登出
        /// </summary>
        public const string TokenLogout = "TokenLogout";
        /// <summary>
        /// 验证
        /// </summary>
        public const string TokenValidate = "TokenValidate";
        /// <summary>
        /// 延时
        /// </summary>
        public const string TokenExtend = "TokenExtend";


        /// <summary>
        /// rbac登录，并获取权限对象
        /// </summary>
        public const string Login = "Login";

        /// <summary>
        /// 权限判断
        /// </summary>
        public const string IsPermitted = "IsPermitted";

        public const string SSoLoginRequest = "ssologinrequest";

        public const string SSoLoginResponse = "ssologinresponse";

    }
}
